package com.example.ospswagger.controller;


import com.example.ospswagger.model.User;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author: lfc
 * @version: 2020/4/10 10:43
 */
@RestController
@Api
//Api的value会在测试端体现，此处不加，根据实际情况而定
public class UserController {

    @RequestMapping(value = "/info/{name}/test")
    @ResponseBody
    @ApiOperation(httpMethod = "GET",value = "查看用户信息",notes = "执行后可返回用户信息，格式为json",nickname = "/info/{name}/test")
    @ApiResponses({@ApiResponse(code = 400,message = "数据执行失败",response = String.class)})
    @ApiImplicitParams({@ApiImplicitParam(name="name",dataType="string",paramType ="path", value="用户名", required=true)})
    public User info(@PathVariable String name) {
        User user = new User();
        user.setName(name);
        user.setAge(100);

        return user;
    }
}
